<cfcomponent>
	<cffunction name="genid" access="public" returntype="string" hint="Creates a random account ID"> 
		<cfset charlist  = "0|2|4|6|8|9|7|5|3|1|0|2|4|6|8|9|7|5|3|1">
        <cfset afid = "">
        <cfloop condition="NOT len(afid)">
            <cfloop from="1" to="7" index="i">
                <cfset ThisNum = RandRange(1,listlen(charlist, "|"))>
                <cfset ThisChar = ListGetAt(Charlist, ThisNum, "|")>
                <cfset afid = "#afid##ThisChar#">
            </cfloop>
            <cfquery name="Checkafid" datasource="#Request.dsn#">
            SELECT * FROM core_accounts
            WHERE aid = <cfqueryparam value="#afid#" cfsqltype="cf_sql_integer">
            </cfquery>
            <cfif Checkafid.RecordCount>
                <cfset afid = "">
            </cfif>
        </cfloop>
		<cfreturn afid>
     </cffunction>            

	<cffunction name="genvstring" access="public" returntype="string" hint="Creates a random verfication string"> 
    	<cfset charlist  = "0|2|4|6|8|9|7|5|3|1|0|2|4|6|8|9|7|5|3|1">
		<cfset today = now()>
		<cfset prevstring1 = dateformat(today, "yyyymmdd")>
        <cfset prevstring2 = timeformat(today, "hhmmss")>
        <cfset ThisNum = RandRange(1,listlen(charlist, "|"))>
        <cfset RandChar1 = ListGetAt(Charlist, ThisNum, "|")>
        <cfset ThisNum = RandRange(1,listlen(charlist, "|"))>
        <cfset RandChar2 = ListGetAt(Charlist, ThisNum, "|")>
        <cfset ThisNum = RandRange(1,listlen(charlist, "|"))>
        <cfset RandChar3 = ListGetAt(Charlist, ThisNum, "|")>
        <cfset ThisNum = RandRange(1,listlen(charlist, "|"))>
        <cfset RandChar4 = ListGetAt(Charlist, ThisNum, "|")>
        <cfset vstring = "#prevstring1##prevstring2##randchar1##randchar2##randchar3##randchar4#">
		<cfreturn vstring>
	</cffunction> 
    
	<cffunction name="gentoken" access="public" returntype="string" hint="Creates a random token">
	  	<cfset epochs = DateDiff("s", "January 1 1974 00:00", Now())>
	    <cfset newtoken = FormatBaseN((RandRange(1,100000000) + epochs),36)>    
		<cfreturn newtoken>
    </cffunction>    
</cfcomponent>